<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/modeloGeral.xhtml">

	<ui:define name="norte">
		<ui:include src="/include/topo.xhtml" />
		<ui:include src="/include/menu.xhtml" />
	</ui:define>

	<ui:define name="centro">
		<p:messages id="msgRematricula" autoUpdate="true" />

		<h:form id="frmRematricula"
			rendered="#{rematriculaBacking.comprovante == null}">
			<p:tabView>
				<p:tab title="#{msg.pnlRematricula}">

					<h:outputText styleClass="bold"
						value="Disciplina(s) regular(es) do #{cursoLogado.ciclo+1} ciclo." />

					<p:dataTable value="#{rematriculaBacking.regulares}" var="regular" emptyMessage="">
						<p:column>
							<f:facet name="header">
							#{msg.colOpcoes}
						</f:facet>
							<p:selectBooleanCheckbox value="#{regular.selecionado}" />
						</p:column>
						<p:column>
							<f:facet name="header">
							#{msg.colDisciplina}
						</f:facet>
						#{regular.nomeDisciplina}
					</p:column>
						<p:column>
							<f:facet name="header">
							#{msg.colPeriodo}
						</f:facet>
						#{cursoLogado.periodo}
					</p:column>
					</p:dataTable>

					<p:separator />
					
					<h:outputText styleClass="bold" value="#{msg.pnlDependenciaNota}" />

					<p:dataTable value="#{rematriculaBacking.dpsNota}" var="dpNota"
						emptyMessage="">
						<p:column>
							<f:facet name="header">
								#{msg.colOpcoes}
							</f:facet>
							<p:selectBooleanCheckbox value="#{dpNota.selecionado}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colDisciplina}
							</f:facet>
							#{dpNota.nomeDisciplina}
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colPeriodo}
							</f:facet>
							#{cursoLogado.periodo}
						</p:column>
					</p:dataTable>

					<p:separator />
					
					<h:outputText styleClass="bold" value="#{msg.pnlDependenciaFalta}" />

					<p:dataTable value="#{rematriculaBacking.dpsFalta}" var="dpFalta"
						emptyMessage="">
						<p:column>
							<f:facet name="header">
								#{msg.colOpcoes}
							</f:facet>
							<p:selectBooleanCheckbox value="#{dpFalta.selecionado}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colDisciplina}
							</f:facet>
							#{dpFalta.nomeDisciplina}
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colPeriodo}
							</f:facet>
							#{cursoLogado.periodoDPFalta}
						</p:column>
					</p:dataTable>
				</p:tab>

				<p:tab title="#{msg.pnlDPNota}" rendered="false">
					<p:dataTable value="#{rematriculaBacking.dpsNota}" var="dpNota"
						emptyMessage="">
						<p:column>
							<f:facet name="header">
								#{msg.colOpcoes}
							</f:facet>
							<p:selectBooleanCheckbox value="#{dpNota.selecionado}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colDisciplina}
							</f:facet>
							#{dpNota.nomeDisciplina}
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colPeriodo}
							</f:facet>
							#{cursoLogado.periodo}
						</p:column>
					</p:dataTable>
				</p:tab>

				<p:tab title="#{msg.pnlDPFalta}" rendered="false">
					<p:dataTable value="#{rematriculaBacking.dpsFalta}" var="dpFalta"
						emptyMessage="">
						<p:column>
							<f:facet name="header">
								#{msg.colOpcoes}
							</f:facet>
							<p:selectBooleanCheckbox value="#{dpFalta.selecionado}" />
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colDisciplina}
							</f:facet>
							#{dpFalta.nomeDisciplina}
						</p:column>

						<p:column>
							<f:facet name="header">
								#{msg.colPeriodo}
							</f:facet>
							#{cursoLogado.periodoDPFalta}
						</p:column>
					</p:dataTable>
				</p:tab>

				<p:tab title="#{msg.pnlProblemas}" rendered="false">
					<h:outputText styleClass="bold" value="#{msg.erroProbSecretaria}" />

					<p:dataTable value="#{rematriculaBacking.problemas}" var="problema"
						emptyMessage="">
						<p:column>
							<f:facet name="header">
								#{msg.colDisciplina}
							</f:facet>
							#{problema.nomeDisciplina}
						</p:column>
					</p:dataTable>
				</p:tab>
			</p:tabView>

			<p:commandButton value="#{msg.btnGravar}"
				onclick="confRematricula.show()" />

			<p:confirmDialog message="#{msg.pnConfRematricula}"
				header="#{msg.pnConfirmacao}" severity="alert"
				widgetVar="confRematricula">
				<p:commandButton value="#{msg.btnSim}"
					oncomplete="confRematricula.hide()"
					action="#{rematriculaBacking.gravar}" update="msgRematricula" />
				<p:commandButton value="#{msg.btnNao}"
					onclick="confRematricula.hide()" type="button" />
			</p:confirmDialog>

		</h:form>

		<h:form id="frmImprimir" target="_blank"
			rendered="#{rematriculaBacking.comprovante != null}">
			<p:panel header="#{msg.pnComprovante}">
				<h:inputTextarea id="txtComprovante" readonly="true"
					styleClass="comprovante" value="#{rematriculaBacking.comprovante}"
					rows="15" />
			</p:panel>

			<p:commandButton value="Imprimir"
				action="#{rematriculaBacking.imprimir}" ajax="false" />
		</h:form>
	</ui:define>

	<ui:define name="sul">
		<!-- <ui:include src="/include/menu.xhtml" /> -->
	</ui:define>

</ui:composition>